home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / PDraw3.0.adf / pdraw_rex.lzh / ClickRadFill.pdrx < prev    next >
Text File  |  1992-06-18  |  1KB  |  51 lines

  1. /*
  2. @N
  3.  
  4. This Genie will allow you to set the center of a radial fill by clicking at some point on the screen.
  5. You may also set the angle of a linear fill relative to the center of the currently selected object.
  6. */
  7. msg = PDSetup.rexx(2,0)
  8. units = getclip(pds_units)
  9. if msg ~= 1 then exit_msg(msg)
  10.  
  11. obj = pdm_SelFirstObj()
  12. if obj = 0 then exit_msg("Please select objects before running this Genie.")
  13.  
  14. clickpos = pdm_GetClickPosn("Click at the where you want the center of fill")
  15. if clickpos = "0 0" then exit_msg()
  16.  
  17. x  = word(clickpos, 1)
  18. y  = word(clickpos, 2)
  19.  
  20. do while obj ~= 0
  21.  opos = pdm_GetObjVisPosn(obj)
  22.  osze = pdm_GetObjVisSize(obj)
  23.  olft = word(opos, 1)
  24.  otop = word(opos, 2)
  25.  owid = word(osze, 1)
  26.  ohgt = word(osze, 2)
  27.  cx  = olft + (.5 * owid)
  28.  cy  = otop + (.5 * ohgt)
  29.  px = (x - cx) / (.5 * owid) * 100
  30.  py = (y - cy) / (.5 * ohgt) * 100
  31.  
  32.  fillpattern = pdm_GetFillPattern(obj)
  33.  parse var fillpattern type '0a'x c1 '0a'x c2 '0a'x steps '0a'x angle '0a'x centerx '0a'x centery
  34.  if  type ~= 2 then angle = atan2(x - cx,cy - y) * 180 / 3.14159
  35.  
  36.  call pdm_SetFillPattern(obj, type, c1, c2, steps, angle, px , py)
  37.  obj = pdm_SelNextObj(obj) 
  38. end
  39.  
  40. exit_msg()
  41.  
  42. exit_msg: procedure expose units
  43. do
  44.  parse arg message
  45.  
  46.  if message ~= '' then call pdm_Inform(1,message,)
  47.  call pdm_SetUnits(units)
  48.  call pdm_AutoUpdate(0)
  49.  exit
  50. end
  51.